<?php
namespace app\admin\model;

use think\facade\Db;
use think\Model;
//订单页
class Order extends Model{
    //订单列表查询
     public static function  orderSql($where,$data){
         $order=Order::alias('o')
             ->field('o.order_id,o.order_sn,o.buyer_name,o.goods_amount,s.order_status,p.payment_name,o.finished_time,o.postscript')
             ->join('ecm_payment p','o.payment_id=p.payment_id')
             ->join('ecm_order_status s','o.status=s.status_id')
             ->where($where)
            ->paginate([
                'list_rows'=> 5,
                'query' => $data
            ]);
         return $order;
         }
         //订单状态复选
      public static function   orderStatus(){
         $status=Order::suffix('_status')->select();
         return $status;

          }

           public static function   getFinishedTimeAttr($v){
            return date('Y-m-d H:i:s',$v);

               }

}